package cn.ecut.service.impl;


import cn.ecut.dao.ShoufeibiaozhunDao;
import cn.ecut.model.Shoufeibiaozhun;
import cn.ecut.service.ShoufeibiaozhunService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.DecimalFormat;
import java.util.List;

@Service
public class ShoufeibiaozhunServiceimpl implements ShoufeibiaozhunService {

    @Autowired
    private ShoufeibiaozhunDao shoufeibiaozhunDao;

    @Override
    public List<Shoufeibiaozhun> selectAll() {
        return shoufeibiaozhunDao.selectAll();
    }

    @Override
    public int selectAllcount() {
        return shoufeibiaozhunDao.selectAllcount();
    }

    @Override
    public int insert(Shoufeibiaozhun shoufeibiaozhun) {
        return shoufeibiaozhunDao.insert(shoufeibiaozhun);
    }

    @Override
    public String getshoufeibiaozhunMa() {
        DecimalFormat decimalFormat=new DecimalFormat("00000");
        String s = shoufeibiaozhunDao.selectThelast();
        s=s.substring(2);
        System.out.println(s);
        int i=Integer.parseInt(s)+1;
        String k=decimalFormat.format(i);
        String shoufeibiaozhunMa = "SF"+k;
        System.out.println(shoufeibiaozhunMa);
        return shoufeibiaozhunMa;
    }

    @Override
    public int updateByPrimaryKey(Shoufeibiaozhun shoufeibiaozhun) {
        return shoufeibiaozhunDao.updateByPrimaryKey(shoufeibiaozhun);
    }

    @Override
    public List<Shoufeibiaozhun> advanceSelect(String s) {
        return shoufeibiaozhunDao.advanceSelect(s);
    }

    @Override
    public int updateQiyong(Shoufeibiaozhun shoufeibiaozhun) {
        return shoufeibiaozhunDao.updateQiyong(shoufeibiaozhun);
    }

    @Override
    public int deleteByPrimaryKey(String shoufeibiaozhunma) {
        return shoufeibiaozhunDao.deleteByPrimaryKey(shoufeibiaozhunma);
    }
}
